<!DOCTYPE html>
<html style="overflow-x:hidden;height:100%;">
<head>
<title>航班列表</title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="mytask/css/ui-boxlb.css">
<link rel="stylesheet" href="mytask/css/ui-baselb.css"> 
<link rel="stylesheet" href="mytask/css/ui-positionlb.css">
<link rel="stylesheet" href="mytask/css/ui-imglb.css">
<link rel="stylesheet" href="mytask/css/ui-colorlb.css">
<link rel="stylesheet" href="mytask/css/ui-inputlb.css">
<link rel="stylesheet" href="css/iBox.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zy_json.js"></script>
<script src="js/base64.js"></script> 
<script src="mytask/js/jquery.js"></script>
<script src="mytask/js/xmlToJson.js"></script>
<script src="mytask/js/main.js"></script>
<script src="js/talkingdata.js"></script>
<script src="js/airport.js"></script>
<style>
    .dashed{ 
        border-top:1px dashed;
    }  
    [more]{ 
        -webkit-transition: all 0.3s ease
    }
    .mapItem{
        height: 2.8em;
        padding: 0 0.6em;
    }
    .flyImg{
        width: .9em;
        height: .9em;
        padding-top:.3em;
        margin: .4em;
    }
    .surplusImg{
        width: .8em;
        height: .8em;
    }
    .airLineImg{
        width: .6em;
        height: 1.4em;
        background: url("mytask/images/img002.jpg") no-repeat center;
        background-size: .6em;
    }
    .lineImg{
        background: url("mytask/images/img003.jpg") no-repeat center;
    }
    .flyInfo{
        padding: .3em 1.5em .3em .1em;
    }
    .c-gray{
        color:gray;
    }
    .c-blue{
        color:blue;
    }
    .c-red{ 
        color:red;
    }
</style> 
</head>
<body style="overflow-x:hidden !important;" class="um-vp" ontouchstart> 
    <div id="" style="background: #eaeaea;width: 100%;">
         <div class="ub" style="background: #fff;padding:0 .1em;border-bottom: .0625em solid #eaeaea;">
               <div class="ub" style="background: #fff;padding: .5em 0;width: 99.5%;margin: 0 auto;">
                   <div class="ub" style=";padding-left: .7em;width: 95%;font-size: .8125em;background: url(image/Rectangle-15-copy.png)no-repeat 0 0;background-size: 1em;background-position:100% center ;line-height: 1.3em;height:1.3em;" onclick="datePicker()">
                       <div id="" >
                           航班日期
                       </div>
                       <div id="" style="background: url(image/iconfont-riqi.png)no-repeat 0 0;background-size: 1.3em;background-position: center 40%;width:1.5em;padding: .5em 0">
                       </div>
                       <div id="selectDate" style="">
                           2016-08-30
                       </div>
                       <!--div id="" style="background: url(image/Rectangle-15-copy.png)no-repeat 0 0;background-size: 1em;background-position: center ;width:1.2em;padding: .5em 0;margin-left: .3em">
                       </div-->
                   </div>
               </div>
           </div>
         <div class="ub" style="background: #fff;padding:0 .1em;border-bottom: .0625em solid #eaeaea;">
           <div class="ub" style="background: #fff;padding: .5em 0;width: 99.5%;margin: 0 auto;">
               <div class="ub" style=";padding-left: .7em;width: 95%;font-size: .8125em;background: url(image/Rectangle-15-copy.png)no-repeat 0 0;background-size: 1em;background-position:100% center ;" onclick="">
                       <div id="" >
                           处置状态
                       </div>
                       <div id="" style="background: url(image/rs.png)no-repeat 0 0;background-size: 1.3em;background-position: center 40%;width:1.5em;padding: .5em 0">
                       </div>
                       <div id="result">
                           未处置
                       </div>
                       <select name="" id="sel">
                           <option value="0">未处置</option>
                           <option value="1">已处置</option>
                       </select>
                       <!--div id="" style="background: url(image/Rectangle-15-copy.png)no-repeat 0 0;background-size: 1em;background-position: center ;width:1.2em;padding: .5em 0;margin-left: .3em">
                       </div-->
                   </div>
               </div>
           </div>
            
           <div id="" style="width:50%;margin:1em auto 0;">
               <div id="" style="width:100%;padding: .3em 0;border-radius: .4em;text-align: center;background: #1C94EA;color:#fff;" onclick="search()">
                   查询
               </div>
           </div>
           <div id="" style="height:1em;">
               
           </div>
    </div>
<div id="msg" class="uba m10 p10 uc-a5 c17 tx-c uhide">很抱歉，未查询到相应的航班列表</div>
<!-- 列表 --> 
<div id="list" style="overflow-x: hidden;width: 100%;">
</div>
</body>
<script>
zy_init();
    window.uexOnload=function(type){ 
         IC.talkingDataCount("不正常航班处置","0204"); 
               // pullDown();
                var date= new Date();
                var year = check(date.getFullYear());
                var month = check(date.getMonth() + 1);
                var days = check(date.getDate()); 
                var Year=JSON.stringify(year); 
               $$("selectDate").innerHTML=Year+"-"+month+"-"+days;
                initDatePicker("selectDate");
                $("#sel").on("change",chag);
                if(localStorage.getItem("yddf_bzchbName")){
                    $("#airportText1").text(localStorage.getItem("yddf_bzchbName"));
                }
                getUser();  
    }
var varUserCode = "";   
var varPassword = ""; 
function getUser(){
    IC.talkingDataCount("不正常航班处置","0204"); 
         //获取掌上东航的账号（用户编号、用户密码）                         
         var localLoginInfor = localStorage.getItem("MU30-USERINFO");
         localLoginInfor=JSON.parse(localLoginInfor);
         //varUserCode=localLoginInfor.username;
         //varPassword=localLoginInfor.password;
         //varUserCode="chengcheng1"; 
         //varPassword="cc_900519!"
         setLocVal("varUserCode",varUserCode);  
         //setLocVal("varPassword",varPassword);
         initData();
}
function rnull(xy){ 
    IC.talkingDataCount("不正常航班处置","0204"); 
    if(xy==undefined||xy==null||xy=="undefined"){
        return "-"
    }else{
        return xy;
    }
}
    function initData(){   
        IC.talkingDataCount("不正常航班处置","0204");  
        $("#list").html('');
        var t_date=$("#selectDate").text();
        var result=$("#sel").val();
        uexWindow.toast(1, 5, '正在加载数据...', -1); 
                var date= new Date();
                var year = date.getFullYear(); 
                var month =date.getMonth() + 1;
                var days = date.getDate();   
                if((month+"").length<2) month="0"+month;   
                if((days+"").length<2) days="0"+days;  
                var thedata= year+"-"+month+"-"+days; 
                //thedata="2016-11-22";  
                //varUserCode="chengcheng1";
                var uname = localStorage['MU30-lOGIN-USRNAME'];
               // uname="chengcheng1";
                //uname="zhangyongshun"
         // var dataUrl="http://172.31.3.190:8080/mpservice/iRRFlightInfo_getIRRFlightInfoByUserNameAndResultAndDate.action?userName="+uname+"&result="+result+"&date="+t_date;
          //varUserCode="kangyiming1";
          var dataUrl="http://mpservice.ceair.com/mpservice/iRRFlightInfo_getIRRFlightInfoByUserNameAndResultAndDate.action?userName="+uname+"&result="+result+"&date="+t_date;;
        console.log(dataUrl)
        $.getJSON(dataUrl, function(data){       
            if(isNotEmptyObject(data)){   
                  console.log("--------------"+JSON.stringify(data));
               if(data.array=="") $("#msg").removeClass("uhide");
                var pagehtml = ''; 
                  for (var i=0; i < data.length; i++) {
                    var arr=rnull(data[i].arrivPort);
                    var dep=rnull(data[i].deptPort);
                    var AIRLINENAME=rnull(data[i].flightCarrier);
                    var FLIGHTNUMBER=rnull(data[i].flightNo);
                    var plantime=rnull(data[i].planDeptTime);
                    if(plantime.length>5){
                        plantime=plantime.substring(11, 16)
                    }
                    var prdtDepttime=rnull(data[i].prdtDeptTime);
                     if(prdtDepttime.length>5){
                        prdtDepttime=prdtDepttime.substring(11, 16)
                    }
                    var publishInfo=rnull(data[i].publishInfo);
                     var airname=dep;
                    for(j=0;j<airportjs.data.items.length;j++){
                        if(airname==airportjs.data.items[j].IATACode){
                            airname=airportjs.data.items[j].FullName;
                        }
                    }
                    var airname1=arr;
                    for(k=0;k<airportjs.data.items.length;k++){
                        if(airname1==airportjs.data.items[k].IATACode){
                            airname1=airportjs.data.items[k].FullName;
                        }
                    }
                    var deleteFlag=data[i].deleteFlag;
                    if(deleteFlag=="OP"){
                        deleteFlag="延误";
                    }else if(deleteFlag=="CNL"){
                        deleteFlag="取消";
                    }else if(deleteFlag=="SHA"){
                        deleteFlag="机场变更";
                    }else if(deleteFlag=="RTB"){
                        deleteFlag="返航";
                    }else if(deleteFlag=="ALT"){
                        deleteFlag="备降";
                    }else if(deleteFlag=="CNLRES"){
                        deleteFlag="取消恢复";
                    }else if(deleteFlag=="OPRES"){
                        deleteFlag="延误恢复";
                    }
                    deleteFlag= rnull(deleteFlag);
                    pagehtml+= '<div class="ub ubb pr" style="border-color:#a0a0a0" onclick="openProjectDetail(\''+data[i].result+'\',\''+data[i].legId+'\',\''+data[i].id+'\',\''+data[i].publishInfo+'\',\''+airname1+'\',\''+airname+'\',\''+data[i].planDeptTime+'\',\''+AIRLINENAME+FLIGHTNUMBER+'\',\''+deleteFlag+'\')">'
                            +'<img src="mytask/images/img182.png" class="flyImg" />'
                            +'<div class="ub-f1 flyInfo">'
                            +'<div class="ub ub-pj fs9 pb1" style="padding:.3em 0;">'
                            +'<div class="">'+AIRLINENAME+FLIGHTNUMBER+'<span class="ml8 fs8 c-gray"></span></div>'
                            +'</div>'
                            +'<div class="ub ub-pj fs9 pb2 ">'
                            +'<div class="">'+airname+'</div>'
                            +'<div class="ub ub-f1 ub-pj">'
                            +'<div class="airLineImg"></div>'
                            +'<div class="ub ub-f1 ub-ac ub-pc"><hr class="ub ub-f1" /></div>'
                            +'<div class="airLineImg"></div>'
                            +'</div>'
                            +'<div class="">'+airname1+'</div>'
                            +'</div>' 
                            +'<div class=" pt2 pb2" style="text-align:center;">'
                            +'<div class="fs9 pb2" style="width:100%;">计飞时间:<span>'+plantime+'</span></div>'
                            +'<div class="fs9 pb2" style="width:100%;">预飞时间:<span>'+prdtDepttime+'</span></div>'
                            +'<div class="fs9 pb2" style="width:100%;color:red"><span>'+deleteFlag+'</span></div>'
                            +'<div class="fs9 pb2" style="width:100%;">对外原因:<span>'+publishInfo+'</span></div>'
                            +'</div>'
                            +'</div>'
                            +'</div>'; 
                }
                 uexWindow.closeToast();
                  document.getElementById("list").innerHTML=pagehtml;
                if(data.length<1||data.length==undefined){
                    uexWindow.toast(0, 5, data.result+"！", 5000);
                }  
            }else{  
                uexWindow.toast(0, 5, "没有更多数据！", 2000);
            }
       }, "json",function(err){
            uexWindow.closeToast();
           alert("err"+JSON.stringify(err));  
       }
       );
    }
     /**
         *点击机号跳转至航班详细界面
         */
     function openTodayDuty(id,openImgId){   
           setLocVal("hbh",id); 
           setLocVal("Key",openImgId);   
           openNewWin("ensureNode","ensureNode_task.html");
           }
      function pullDown(){
        var j = {
            "pullToReloadText":"下拉刷新",
            "releaseToReloadText":"释放立即刷新",
            "loadingText":"正在刷新...",
            "loadingImagePath":"res://shuaxin.png"
        };
        if(!uexWindow.setBounce)
            return;
        uexWindow.setBounce("1");
        uexWindow.setBounceParams('0',JSON.stringify(j));
        uexWindow.showBounceView("0","#f4f4f4",1);
        uexWindow.showBounceView("1","#f4f4f4",0);
        uexWindow.notifyBounceEvent("0","1");
        uexWindow.onBounceStateChange = function(type,status){
            if(type==0 && status==2) {
                uexWindow.resetBounceView('0');
                initData()
            }
        }
    }; 
     function selectAirPort(){
         IC.talkingDataCount("不正常航班处置","0204"); 
            openNewWin("airport_select1","airport_select1.html");
        }
       function datePicker(){
           IC.talkingDataCount("不正常航班处置","0204"); 
                var date= new Date();
                var year = check(date.getFullYear());
                var month = check(date.getMonth() + 1);
                var days = check(date.getDate());
                uexControl.openDatePicker(year,month,days);
        }  
         function check(myDate){
            if(myDate <　10){
            myDate= "0" + Number(myDate);
            }
            return myDate;
        }
          function initDatePicker(id){
              IC.talkingDataCount("不正常航班处置","0204"); 
             //talkingDataCount("外站站长","0061");
            //初始化ios原生日期选择框
                var cText = 0;
                var cJson = 1;
                var cInt = 2;
                //Flag=1;
                uexControl.cbOpenDatePicker=function(opCode,dataType,data){
                    switch(dataType){
                        case cText:
                          //alert("uex.cText");
                          break;
                        case cJson:
                          if(dataType==1){
                            var obj = eval('('+data+')');
                            var date= new Date();
                            var year = date.getFullYear();
                            var month = date.getMonth() + 1;
                            var days = date.getDate();
                            var dd = new Date(); 
                            var year = dd.getFullYear();
                            var month = dd.getMonth() + 1;
                            var days = dd.getDate();
                            dd.setDate(dd.getDate()-1);//获取昨天的日期 
                            var y = dd.getFullYear(); 
                            var m = (dd.getMonth()+1);//获取当前月份的日期
                            var d = dd.getDate(); //获取当前几号
                            var dd1 = new Date(); 
                            dd1.setDate(dd1.getDate()-2);//获取前天的日期 
                            var y1 = dd1.getFullYear(); 
                            var m1 = (dd1.getMonth()+1);//获取当前月份的日期
                            var d1 = dd1.getDate(); //获取当前几号
                            var dd2 = new Date(); 
                            dd2.setDate(dd2.getDate()+1);//获取前天的日期 
                            var y2 = dd2.getFullYear(); 
                            var m2 = (dd2.getMonth()+1);//获取当前月份的日期
                            var d2 = dd2.getDate(); //获取当前几号
                            var dd3 = new Date(); 
                            dd3.setDate(dd3.getDate()+2);//获取前天的日期 
                            var y3 = dd3.getFullYear(); 
                            var m3 = (dd3.getMonth()+1);//获取当前月份的日期
                            var d3 = dd3.getDate(); //获取当前几号
                            Flag=0;
                            if((d2==obj.day&&y2==obj.year&&m2==obj.month)||(d3==obj.day&&y3==obj.year&&m3==obj.month)||(d==obj.day&&y==obj.year&&m==obj.month)||(d1==obj.day&&y1==obj.year&&m1==obj.month)||(days==obj.day&&year==obj.year&&month==obj.month)){
                                var year= obj.year;
                                var yearStr = year.toString();
                                var month=check(obj.month);
                                var day=check(obj.day);
                                //Flag=1;
                                setLocVal("Year",yearStr);
                                $$(id).innerHTML = yearStr+"-"+month+"-"+day;
                            }else{
                                alert("只能选择近三天数据");
                                var date= new Date();
                                var year = check(date.getFullYear());
                                var month = check(date.getMonth() + 1);
                                var days = check(date.getDate());
                                var Year=JSON.stringify(year);
                                setLocVal("Year",Year);
                                $$(id).innerHTML=Year.substr(2,2)+"/"+month+"/"+days;
                                //$$(id).innerHTML = yearStr.substr(2,2)+"/"+month+"/"+day;
                            }
                           // initData()
                           //  $$("flighDataInfo").innerHTML = "";
                           // pageNum=[];
                           // airportSearch();
                           //queryCurrentAirport();
                        }
                        break;
                      case cInt:
                        //alert("uex.cInt");
                        break;
                      default:
                        //alert("error");
                   }
                };
                //queryAirPortInfo();
            }
            function chag(){
                IC.talkingDataCount("不正常航班处置","0204"); 
                if($("#sel").val()==0){
                    $("#result").html("未处置");
                }else if($("#sel").val()==1){
                    $("#result").html("已处置");
                }
            }
            function openProjectDetail(n,lid,id,publishInfo,arr,dep,time,hbh,deleteFlag){
             //talkingDataCount("外站站长","0061");
            //setLocVal("yddf_bzcRes",n); 
            //setLocVal("yddf_bzcLegId",lid); 
            //setLocVal("yddf_bzcId",id); 
            //setLocVal("yddf_bzcPublishInfo",publishInfo);
            var data={
                "n":n,
                "lid":lid,
                "id":id,
                "publishInfo":publishInfo,
                "arr":arr,
                "dep":dep,
                "time":time,
                "hbh":hbh,
                "deleteFlag":deleteFlag
            }
            console.log(JSON.stringify(data))
            setLocVal("yddf_bzcAll",JSON.stringify(data))
            openNewWin("shangBaoProject2","shangBaoProject2.html");
        }
        function search(){
            IC.talkingDataCount("不正常航班处置","0204"); 
            initData()
        }
</script>
</html>